<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }


        .title {
            text-align: center;
            font-weight: 800;
            font-size: 20px;
            margin-top: 50px;
            margin-bottom: 50px;
        }

        .item {
            margin-top: 15px;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        .list .item img {
            width: 50px;
            border-radius: 50%;
        }

        .list .item .right button {
            width: 70px;
            text-align: center;
            color: white;
            background-color: rgb(120, 86, 243);
            border: 0;
            height: 30px;
            border-radius: 10px;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="title">任务列表</div>
        <div class="list">
            <div class="item" v-for="(item,index) in tasklist" v-bind:key="index">
                <div class="left">
                    <img v-bind:src="item.pic" alt="">
                </div>
                <div class="zhong">
                    <div>{{ item.name }}</div>
                    <div>{{ item.main }}</div>
                </div>
                <div class="right">
                    <button @click="changestatic(item)"> {{ item.static == 1 ? '去完成' : (item.static == 2 ? '领取' : '已领取') }} </button>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="./vue-2.5.21.js"></script>
<script>
    var v = new Vue({
        el: '#app',
        data: {
            tasklist: [
                { id: 1, pic: 'img/pic.png', name: '爱奇艺送会员', main: '完成任务免费送1个月会员', static: 1 },
                { id: 2, pic: 'img/pic.png', name: '腾讯视频送会员', main: '完成任务免费送1个月会员', static: 3 },
                { id: 3, pic: 'img/pic.png', name: '芒果视频送会员', main: '完成任务免费送1个月会员', static: 2 },
                { id: 4, pic: 'img/pic.png', name: '优酷视频送会员', main: '完成任务免费送1个月会员', static: 1 }
            ]
        },
        methods: {
            changestatic(item) {
                if (item.static == 1) {
                    item.static = 2
                } else if (item.static == 2) {
                    item.static = 3
                }
                console.log(item.static);

            }
        }
    }) 
</script>